package cn.cau.epidemicsurveysystem.dao;

import cn.cau.epidemicsurveysystem.bean.PatientTripBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface PatientTripRepository extends JpaRepository<PatientTripBean,Integer> {
    @Override
    PatientTripBean save(PatientTripBean patientTripBean);

    List<PatientTripBean> findPatientTripBeansByMissionIdEqualsOrderByArrivalTime(long missionId);

    @Query(value = "SELECT * from patientTrip where missionId=?1 and arrivalTime > ?2 and arrivalTime < ?3 order by arrivalTime", nativeQuery = true)
    List<PatientTripBean> findPatientTripBeansByDate(long missionId,String start,String end);
}
